Fix virtual surface crossing#3934
Conversation
04f48e9 to
e406ce9
Compare
e406ce9 to
c0d1ce4
Compare
|
I haven't looked at this in detail at all, but I think this would also fix the problem I described in #3186 if I am not mistaken. |
|
I think you are right. Are you interested in reviewing this PR? |
HunterBelanger
left a comment
There was a problem hiding this comment.
Other than my one comment, this generally looks okay to me and seems to solve the problem I observed, and should also fix the other current bug which another user reported. We should see what someone else thinks though, before merging such an important change which has geometry changes.
|
@HunterBelanger, could you approve this PR? |
paulromano
left a comment
There was a problem hiding this comment.
Thanks a lot for proposing this @GuySten, and it's encouraging to see that it does address the behaviors that were documented in the linked issues! However, I am concerned about the performance impact as described below. Also, I tried this out on a few complex models that I have access to and on at least one of them (JET), it seems to result in an infinite loop. I'll have to dig into why this is but that will need to be resolved before this could move forward.
| if (d < min_dist) { | ||
| if (min_dist - d >= FP_PRECISION * min_dist) { | ||
| if (contains_complex(r + (d + TINY_BIT) * u, u, on_surface) != |
There was a problem hiding this comment.
I'm concerned about the performance impact of this. In the worst case scenario, this means that for a cell with N half-spaces bounding it, you could end up doing N extra cell containment checks. Obviously the average case will be less, but nevertheless it's a cause for concern. I'm going to look into alternatives for how to handle this.

Description
Currently, when using complex cells openmc sometimes decide that a particle cross surface that is not on the boundary of the complex cell.
In the illustration below a particle in cell 2 cross a surface and still stays in cell 2 (a virtual crossing).
This PR fix that behavior by adding another check in complex cells that after the surface crossing the particle should be outside the cell.
Fixes #3924
Fixes #3186
Checklist
I have made corresponding changes to the documentation (if applicable)